package com.kasinf.sample.mybatis.service;

import com.kasinf.framework.mybatis.service.BaseServiceImpl;
import com.kasinf.sample.mybatis.dal.dataobject.UserDO;
import com.kasinf.sample.mybatis.dal.mysql.UserMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * @Author : Kaiser
 * @Date: 2025/5/19  11:03
 */
@Service
@RequiredArgsConstructor
public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO> implements UserService {

    private final UserMapper userMapper;


    @Override
    @Cacheable(value = "sys:user", key = "#id", unless = "#result==null")
    public UserDO getFromCache(Serializable id) {
        return getById(id);
    }
}
